﻿using Microsoft.Xna.Framework;
using ShevaEngine.Core.Modules.Graphics;
using ShevaEngine.Core.Modules.Graphics.Cameras;

namespace ShevaEngine.Core.Modules.Scenes
{
    /// <summary>
    /// Graphics scene object transformation.
    /// </summary>
    public class SceneNodeTransformation : SceneNode
    {
        /// <summary>Transformation matrix.</summary>
        public Matrix Transform;

        /// <summary>
        /// Constructor.
        /// </summary>
        public SceneNodeTransformation()
            : base()
        {
            this.Transform = Matrix.Identity;
        }

        /// <summary>
        /// Override Add in rendering pipeline method.
        /// </summary>
        /// <param name="renderingPipeline"></param>
        /// <param name="worldMatrix"></param>
        public override bool AddInRenderingPipeline(RenderingPipeline renderingPipeline, Camera camera, Matrix worldMatrix)
        {
            base.AddInRenderingPipeline(renderingPipeline, camera, this.Transform * worldMatrix);

            return false;
        }

        /// <summary>
        /// Override Add in rendering pipeline method.
        /// </summary>
        /// <param name="renderingPipeline"></param>
        /// <param name="worldMatrix"></param>
        public override bool AddInRenderingPipeline(RenderingPipeline renderingPipeline, Vector3 position, float distanceSquared, Matrix worldMatrix)
        {
            base.AddInRenderingPipeline(renderingPipeline, position, distanceSquared, this.Transform * worldMatrix);

            return false;
        }
    }
}
